import java.util.*;

class Student {
    String id;
    String name;
    String[] courses;

    public Student(String id, String name, String[] courses) {
        this.id = id;
        this.name = name;
        this.courses = courses;
    }
}

class Course {
    String name;
    String day;
    String startTime;
    String endTime;

    public Course(String name, String day, String startTime, String endTime) {
        this.name = name;
        this.day = day;
        this.startTime = startTime;
        this.endTime = endTime;
    }
}

 class ClassSchedule {
    private static final List<Course> courses = Arrays.asList(
            new Course("语文", "周六", "8:00", "10:00"),
            new Course("数学", "周六", "10:00", "12:00"),
            new Course("英语", "周六", "14:00", "16:00"),
            new Course("物理", "周六", "16:00", "18:00"),
            new Course("化学", "周日", "8:00", "10:00"),
            new Course("体育", "周日", "10:00", "12:00"),
            new Course("生物", "周日", "14:00", "16:00"),
            new Course("音乐", "周日", "16:00", "18:00")
    );

    public static void main(String[] args) {
        // 学生数据通过二维数组体现
        String[][] studentCourses = {
                {"S1", "语文", "数学"},
                {"S2", "数学", "英语"},
                {"S3", "英语", "物理"},
                {"S4", "物理", "化学"},
                {"S5", "化学", "生物"},
                {"S6", "生物", "音乐"},
                {"S7", "音乐", "体育"},
                {"S8", "体育", "语文"},
                {"S9", "语文", "数学"},
                {"S10", "数学", "英语"},
                {"S11", "英语", "物理"},
                {"S12", "物理", "化学"},
                {"S13", "化学", "生物"},
                {"S14", "生物", "音乐"},
                {"S15", "音乐", "体育"},
                {"S16", "体育", "语文"},
                {"S17", "语文", "数学"},
                {"S18", "数学", "英语"},
                {"S19", "英语", "物理"},
                {"S20", "物理", "化学"},
                {"S21", "化学", "生物"},
                {"S22", "生物", "音乐"},
                {"S23", "音乐", "体育"},
                {"S24", "体育", "语文"},
                {"S25", "语文", "数学"},
                {"S26", "数学", "英语"},
                {"S27", "英语", "物理"},
                {"S28", "物理", "化学"},
                {"S29", "化学", "生物"},
                {"S30", "生物", "音乐"}
        };

        List<Student> students = new ArrayList<>();
        for (String[] data : studentCourses) {
            students.add(new Student(data[0], data[0], new String[]{data[1], data[2]}));
        }

        // 生成课表
        generateClassSchedule(students);
    }

    private static void generateClassSchedule(List<Student> students) {
        for (Course course : courses) {
            System.out.println("课程：" + course.name + " 时间：" + course.day + " " + course.startTime + " - " + course.endTime);
            List<String> studentNames = new ArrayList<>();
            for (Student student : students) {
                if (Arrays.asList(student.courses).contains(course.name)) {
                    studentNames.add(student.id);
                }
            }
            System.out.println("学生名单：" + String.join(", ", studentNames));
            System.out.println();
        }
    }
}